package samples.chapter05;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Chapter05BookService {
    @Autowired
    Chapter05BookMapper bookMapper;

    public void addBook(Chapter05Book book) {
        bookMapper.addBook(book);
    }

    public int deleteBook(int id) {
        return bookMapper.deleteBook(id);
    }

    public int updateBook(Chapter05Book book) {
        return bookMapper.updateBook(book);
    }

    public Chapter05Book getBookById(int id) {
        return bookMapper.getBookById(id);
    }

    public List<Chapter05Book> getAllBooks() {
        return bookMapper.getAllBooks();
    }
}
